<template>
    <div class="card">
        <!-- {{this.cardData}} -->
        <div class="block">
            <div v-if="this.cardData == ''" class="noEquipment"> 
                该项绑定设备未开启
            </div>
            <el-carousel trigger="click" class="card_hight" :autoplay="false" :initial-index="cardData.index" >
            <el-carousel-item v-for="item in cardData.unit" :key="item.index">
                <!-- 设备标题 -->
                <router-link to="/overview">
                    <h4 class="normal" @click="router('airclean',item)" :title="item.name">
                    <!-- <svg class="icon card_icon" aria-hidden="true">
                        <use xlink:href="#icon-xinfeng-copy"></use>
                    </svg> -->
                    <img class="title_icon" src="../../assets/title.png" alt />
                    {{item.typename}}:&nbsp;{{item.name}}
                 </h4>
                </router-link>
                <!-- 卡片内容 -->
                <div class="card_padding">
                    <div class="airclean_top">
                        <div class="airclean_pm airclean_pm1">
                            <svg class="icon card_icon" aria-hidden="true">
                                <use xlink:href="#icon-app_icons--pm255"></use>
                            </svg>
                            <div class="airclean_pm_val">
                                <p class="p1 p1_blue">{{item.unit[3].value.toFixed(0)}}</p>
                                <p class="p2">{{item.unit[3].flag}}</p>
                            </div>
                            
                            
                        </div>
                        <div class="airclean_pm airclean_pm2">
                            <svg  class="icon card_icon"  aria-hidden="true">
                                <use xlink:href="#icon-app_iconspm10---copy"></use>
                            </svg>
                            <div class="airclean_pm_val">
                                <p class="p1 p1_green">{{item.unit[4].value.toFixed(0)}}</p>
                                <p class="p2">{{item.unit[4].flag}}</p>
                            </div>
                        </div>
                    </div>
                    <div class="airclean_bottom airclean_bottom_top">
                        <div v-if="item.unit[0].ready == 1">
                            <p class="p3" style="color: #38bdea">{{item.unit[0].value.toFixed(0)}} <span>{{item.unit[0].flag}}</span></p>
                            <p class="p4">{{item.unit[0].name}}</p>
                        </div>
                        <div v-if="item.unit[1].ready == 1">
                            <p class="p3" style="color: #38bdea">{{item.unit[1].value.toFixed(0)}} <span>{{item.unit[1].flag}}</span></p>
                            <p class="p4">{{item.unit[1].name}}</p>
                        </div>
                        <div v-if="item.unit[2].ready == 1">
                            <p class="p3" style="color: #38bdea">{{item.unit[2].value.toFixed(0)}} <span>{{item.unit[2].flag}}</span></p>
                            <p class="p4">{{item.unit[2].name}}</p>
                        </div>
                    </div>
                    <div class="airclean_bottom">
                        <div v-if="item.unit[7].ready == 1">
                            <p class="p5"> <span :class="item.unit[7].value == 1 ? 'p5_green':'p5_gray'">开机</span><span style="margin:0 5px">|</span><span :class="item.unit[7].value == 0 ? 'p5_green':'p5_gray'">关机</span> </p>
                        </div>
                        <div v-if="item.unit[6].ready == 1">
                            <p class="p5"> <span :class="item.unit[6].value == 1 ? 'p5_green':'p5_gray'">自动</span><span style="margin:0 5px">|</span><span :class="item.unit[6].value == 0 ? 'p5_green':'p5_gray'">手动</span> </p>
                        </div>
                        <div v-if="item.unit[5].ready == 1">
                            <p class="p5"> <span :class="item.unit[5].value == 1 ? 'p5_green':'p5_gray'">低速</span><span style="margin:0 5px">|</span><span :class="item.unit[5].value == 0 ? 'p5_green':'p5_gray'">高速</span> </p>
                        </div>
                    </div>
                    
                </div>
                 
            </el-carousel-item>
            </el-carousel>
        </div>
        
    </div>
</template>

<script>
export default {
    props: ['nowIndex', 'cardData', 'nowId'],
    data () {
        return{
        }
    },
    created() {
    },
    methods: {
        // 跳转
        router(val,item){
            var arr = {
                addr:item.addr,
                name:item.name,
                type:item.type,
                uid:item.uid
            }
            localStorage.setItem("当前设备编号", JSON.stringify(arr))
            localStorage.setItem("menuRouter", val)
        },
    },
     // 清除定时器
    beforeDestroy() {
    },
}
</script>

<style scoped>

/deep/ .el-carousel__container .el-carousel__arrow {
    height: 150px !important;
    width: 110px !important;
    border-radius: 0;
    background: none;
}
/deep/ .el-icon-arrow-left {
    margin-left: -110px !important;
}
/deep/ .el-icon-arrow-right{
    margin-right: -110px !important;
}
/deep/ .el-carousel__indicators{
    display: none;
}
.normal .card_icon{
    font-size: 20px;
}
/deep/ .card_padding {
    padding: 0px 20px 0px 20px !important;
}
.airclean_top{
    display: flex;
    align-items: center; 
    justify-content: space-around;
}
.airclean_pm{
    width: 150px;
    height: 90px;
    position: relative;
    text-align: center;
    display: flex;
    align-items: center; 
    padding-top: 15px;
    padding-left: 10px;
    /* justify-content: center; */
    /* flex-direction: column; */
}
.airclean_pm::after,
.airclean_pm::before {
    width: 20px;
    height: 20px;
    content: "";
    position: absolute;
    transition: all 0.8s ease;
}

.airclean_pm::before {
    /* top: -5px;
    left: -5px; */
    left: -1px;
    bottom: -2px;
    /* border-top: 1px solid #9ce0ffbd; */
    border-left: 1px solid #9ce0ffbd;
    border-bottom: 1px solid #9ce0ffbd;
}

.airclean_pm::after {
    right: -1px;
    bottom: -2px;
    border-bottom: 1px solid #9ce0ffbd;
    border-right: 1px solid #9ce0ffbd;
}
.airclean_pm1{
    /* border: 1px solid #9ce0ffbd; */
    background: linear-gradient(to bottom , rgba(255, 0, 0, 0), #0168b7 300%);
}
.airclean_pm2{
    /* border: 1px solid #9ce0ffbd; */
    background: linear-gradient(to bottom , rgba(255, 0, 0, 0), #32b16c 300%);
}
.airclean_pm_val{
    width: 95px;
    line-height: 25px;
    padding-top: 5px;
    padding-left: 5px;
}
.p1{
    font-size: 25px;
    width: 90px;
    overflow: hidden;
    /* margin-bottom: 5px; */
}
.p1_blue{
    color: #42a3ca;
}
.p1_green{
    color: #32b16c;
}
.p2{
    font-size: 15px;
    color: #acacac;
}
.card_icon{
    font-size: 40px;
}
.airclean_bottom{
    display: flex;
    text-align: center;
    margin-top: 10px;
}
.airclean_bottom_top{
    margin-top:14px;
}

.airclean_bottom>div{
    flex: 1;
}
.p3{
    width: 135px;
    overflow: hidden;
    margin: 0 auto;
    font-size: 24px;
    font-weight: 500;
    text-align: center;
    line-height: 40px;
    text-indent: 0px;
    white-space: nowrap;
}
.p3 span{
    color: #bbbbbb;
    font-size: 15px;
}
.p4{
    overflow: hidden;
    width: 102px;
    margin: 0 auto;
    white-space: nowrap;
        margin-top: -4px;
    font-size: 14px;
}
.p5{
    width: 105px;
    margin: 0 auto;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    line-height: 40px;
    text-indent: 0px;
    /* color: #C45911; */
    color: #facd86;
    font-weight: lighter;
}
.p5_green{
    color: #38bdea;
    /* color: #2E74B5; */
}
.p5_gray{
    color: #bbbbbb;
}
/*  */
/* .airclean_top{
    display: flex;
    text-align: center;
}
.airclean_top>div{
    flex: 1;
}
.p1{
    width: 98px;
    overflow: hidden;
    font-size: 25px;
    font-weight: 500;
    text-align: center;
    line-height: 40px;
    text-indent: 0px;
}
.p3{
    overflow: hidden;
    width: 102px;
    white-space: nowrap;
}
.airclean_bottom{
    display: flex;
}
.airclean_left{
    text-align: center;
    margin-top: 20px;
    flex: 1;
}
.airclean_air{
    width: 40px;
    height: 40px;
    margin: 0 auto;
    margin-top: 15px;
    margin-bottom: 5px;
    line-height: 45px;
    text-align: center;
    border-radius: 100%;
    border: 1px solid #fff;
}
.airclean_air_color1{
    background: linear-gradient(to bottom , rgba(255, 0, 0, 0), #217867d9 50%);
}
.airclean_air_color2{
    background: linear-gradient(to bottom , rgba(255, 0, 0, 0), #785d21d9 50%);
}
.airclean_air_color3{
    background: linear-gradient(to bottom , rgba(255, 0, 0, 0), #782121d9 50%);
}
.airclean_jun{
    width: 25px;
    height: 25px;
    margin: 0 auto;
    margin-bottom: 5px;
    border-radius: 100px;
}
.airclean_open{
    background: #46d7ee;
}
.airclean_close{
    background: #78888a;
}
.airclean_right{
    flex: 1;
}
.airclean_right p{
    font-size: 34px;
    font-weight: 500;
    text-align: center;
    line-height: 40px;
    text-indent: 0px;
}
.airclean_right .p4{
    color: #01fdfe;
    font-size: 26px;
    text-align: center;
    text-indent: 0px;
    margin-bottom: 5px;
    margin-top: 50px;
} 
.airclean_right p span{
    font-size: 16px;
    margin-left: 5px;
    color: #fff;
}
.airclean_right  h4{
    font-weight: 400;
    text-indent: 0px;
    font-size: 20px;
    text-align: center;
} */
</style>